package ytmc.setup;


/**
 * List of all supported video formats
 *
 * @author Kicok
 */
public enum VideoFormat
{
    FMT_AVI( "avi" ),
    FMT_FLV( "flv" ),
    FMT_MKV( "mkv" ),
    FMT_MOV( "mov" ),
    FMT_MP4( "mp4" ),
    FMT_MPEG( "mpeg" ),
    FMT_WMV( "wmv" );


    private VideoFormat( String friendlyName )
    {
        this.friendlyName = friendlyName;
    }


    private String friendlyName;

    public String getFriendlyName()
    {
        return friendlyName;
    }


    public static final VideoFormat DEFAULT_FORMAT = VideoFormat.FMT_AVI;

    public static VideoFormat get( int i )
    {
        return VideoFormat.values()[i];
    }

    public static VideoFormat get( String friendlyName )
    {
        return get( friendlyName, DEFAULT_FORMAT );
    }

    public static VideoFormat get( String friendlyName, VideoFormat defaultVideoFormat )
    {
        for( VideoFormat videoFormat : VideoFormat.values() )
        {
            if( videoFormat.getFriendlyName().equalsIgnoreCase( friendlyName ) )
            {
                return videoFormat;
            }
        }

        return defaultVideoFormat;
    }


    public static String[] friendlyNames()
    {
        int i = 0;
        int len = VideoFormat.values().length;

        String[] friendlyNames = new String[len];
        for( VideoFormat videoFormat : VideoFormat.values() )
        {
            friendlyNames[i] = videoFormat.getFriendlyName();
            i++;
        }

        return friendlyNames;
    }
}
